package com.wc.算法基础课.F第六讲贪心.填充;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/4/12 15:31
 * @description https://www.acwing.com/problem/content/4969/
 */
public class Main {
    static Scanner sc = new Scanner(System.in);
    static int n;
    static char[] s;

    public static void main(String[] args) {
        s = (" " + sc.next()).toCharArray();
        n = s.length - 1;
        int res = 0;
        for (int i = 2; i <= n; i++) {
            if (s[i] == s[i - 1] || s[i] == '?' || s[i - 1] == '?') {
                res++;
                i++;
            }
        }
        System.out.println(res);
    }
}

